﻿namespace Sofire.Data
{
    using System;
    using System.Collections.Generic;
    using System.Data;

    #region Delegates

    /// <summary>
    /// 数据库操作完成后的事件委托。
    /// </summary>
    /// <param name="sender">事件对象。</param>
    /// <param name="e">事件参数。</param>
    public delegate void ExecutedEventHandler(object sender, ExecutedEventArgs e);

    #endregion Delegates

    /// <summary>
    /// 表示数据库操作完成后的事件参数。
    /// </summary>
    public class ExecutedEventArgs : ExecutingEventArgs
    {
        #region Fields

        private IResult _Result;

        #endregion Fields

        #region Constructors

        /// <summary>
        /// 初始化 <see cref="Sofire.Data.ExecutedEventArgs"/> 的新实例。
        /// </summary>
        /// <param name="type">执行的类型。</param>
        /// <param name="result">数据库的操作结果。</param>
        /// <param name="commandList">执行命令的集合。</param>
        public ExecutedEventArgs(ExecuteType type, IResult result, List<ExecuteCommandBase> commandList)
            : base(type, commandList)
        {
            this._Result = result;
        }

        /// <summary>
        /// 初始化 <see cref="Sofire.Data.ExecutedEventArgs"/> 的新实例。
        /// </summary>
        /// <param name="type">执行的类型。</param>
        /// <param name="result">数据库的操作结果。</param>
        /// <param name="command">执行的命令。</param>
        public ExecutedEventArgs(ExecuteType type, IResult result, ExecuteCommandBase command)
            : base(type, command)
        {
            this._Result = result;
        }

        #endregion Constructors

        #region Properties

        /// <summary>
        /// 获取一个值，表示数据库的操作结果。
        /// </summary>
        public IResult Result
        {
            get
            {
                return this._Result;
            }
        }

        #endregion Properties
    }
}